package utils

import "golang.org/x/crypto/bcrypt"

// HandlePwdEncryptionMd5 密码加密
func HandlePwdEncryptionMd5(pwd string) (string, error) {
	encryption, err := bcrypt.GenerateFromPassword([]byte(pwd), bcrypt.DefaultCost)
	return string(encryption), err
}

func HandlePwdParseMd5(hashPwd string, pwd string) error {
	return bcrypt.CompareHashAndPassword([]byte(hashPwd), []byte(pwd))
}
